package org.action;

import java.util.List;
import java.util.Map;

import org.bean.O2rankgame;
import org.bean.O2ranksongs;
import org.service.GameService;
import org.service.HotSongsService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class SelectMusicInfoAction extends ActionSupport {

	private O2ranksongs o2ranksongs;
	private O2rankgame o2rankgame;
	private GameService gameservice;
	private HotSongsService hotsongsservice;
	private int mid;
	private String info;
	private String condition;
	
	@Override
	public String execute() throws Exception {

		if (condition != null) {
			if (condition.equals("MusicName")) {
				String str[] = info.split("\\^");
				mid = Integer.parseInt(str[1]);
			}
			
		}
		
		
		
//1、根据歌曲id 查询歌曲信息 2、根据歌曲id 查询前10成绩 
		o2ranksongs = hotsongsservice.SelectMusicByid(mid);
		List<O2rankgame> list = gameservice.selectSongsTopByMid(mid);
		Map request = (Map) ActionContext.getContext().get("request");
		
		
		request.put("list", list);
		
		return SUCCESS;
	}

	public O2ranksongs getO2ranksongs() {
		return o2ranksongs;
	}

	public void setO2ranksongs(O2ranksongs o2ranksongs) {
		this.o2ranksongs = o2ranksongs;
	}

	public O2rankgame getO2rankgame() {
		return o2rankgame;
	}

	public void setO2rankgame(O2rankgame o2rankgame) {
		this.o2rankgame = o2rankgame;
	}

	public GameService getGameservice() {
		return gameservice;
	}

	public void setGameservice(GameService gameservice) {
		this.gameservice = gameservice;
	}

	public HotSongsService getHotsongsservice() {
		return hotsongsservice;
	}

	public void setHotsongsservice(HotSongsService hotsongsservice) {
		this.hotsongsservice = hotsongsservice;
	}

	public int getMid() {
		return mid;
	}

	public void setMid(int mid) {
		this.mid = mid;
	}
	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	
}
